<?php

/**
 * @property Crm_custom $crm_custom
 */
class Crm_custom extends CI_Model
{

    public $id;
    public $company_name;
    public $short_name;

//    public function __construct() {
//        parent::__construct();
//        $this->load->database();
//    }

    public function get_last_ten_entries() {
//        echo '33';exit;
//        dump($this->db);exit;
        $query = $this->db->get('crm_custom', 10);
//        return $this->db->get_compiled_select('crm_custom');
        return $query->result();
    }

    public function insert_entry() {
        $this->company_name = 'abc';//$_POST['title']; // please read the below note
        $this->short_name = 'test';//$_POST['content'];
//        $this->date = time();

        $this->db->insert('crm_custom', $this);
    }

    public function update_entry() {
        $this->company_name = 'cba';//$_POST['title'];
        $this->short_name = 'dddd';//$_POST['content'];
//        $this->date = time();

        $this->db->update('entries', $this, array('id' => $_POST['id']));
    }

}